#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 2e5 + 10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int a[N];
void solve()
{
    memset (a, 0, sizeof a);
    string s;
    cin >> s;
    a[0] = 1;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == 'E') a[i + 1] = a[i];
        else a[i + 1] = 1 - a[i];
    }
    //cout<<a[0]<<" "<<a[s.size()]<<'\n';
    for(int i = 0; i <= s.size(); i++) cout << a[i] << " ";
    cout << "-----------\n" << '\n';
    if(a[s.size()] != a[0]) cout << "NO" << '\n';
    else cout << "YES" << '\n';


}

int main()
{
    close();
    int T;
    cin >> T;
    while (T--) solve();
    return 0;
}